package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.Delivery;
import com.ruoyi.system.mapper.DeliveryMapper;
import com.ruoyi.system.service.IDeliveryService;
import com.ruoyi.system.vo.DeliveryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 发货记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-14
 */
@Service
public class DeliveryServiceImpl implements IDeliveryService
{
    @Autowired
    private DeliveryMapper deliveryMapper;

    /**
     * 查询发货记录
     * 
     * @param id 发货记录主键
     * @return 发货记录
     */
    @Override
    public Delivery selectDeliveryById(Long id)
    {
        return deliveryMapper.selectDeliveryById(id);
    }

    /**
     * 查询发货记录列表
     * 
     * @param delivery 发货记录
     * @return 发货记录
     */
    @Override
    public List<Delivery> selectDeliveryList(Delivery delivery)
    {
        return deliveryMapper.selectDeliveryList(delivery);
    }

    /**
     * 新增发货记录
     * 
     * @param delivery 发货记录
     * @return 结果
     */
    @Override
    public int insertDelivery(Delivery delivery)
    {
        delivery.setCreateTime(DateUtils.getNowDate());
        return deliveryMapper.insertDelivery(delivery);
    }

    /**
     * 修改发货记录
     * 
     * @param delivery 发货记录
     * @return 结果
     */
    @Override
    public int updateDelivery(Delivery delivery)
    {
        delivery.setUpdateTime(DateUtils.getNowDate());
        return deliveryMapper.updateDelivery(delivery);
    }

    /**
     * 批量删除发货记录
     * 
     * @param ids 需要删除的发货记录主键
     * @return 结果
     */
    @Override
    public int deleteDeliveryByIds(Long[] ids)
    {
        return deliveryMapper.deleteDeliveryByIds(ids);
    }

    /**
     * 删除发货记录信息
     * 
     * @param id 发货记录主键
     * @return 结果
     */
    @Override
    public int deleteDeliveryById(Long id)
    {
        return deliveryMapper.deleteDeliveryById(id);
    }

    @Override
    public DeliveryVO selectDeliveryByshipmentOrderId(Long shipmentOrderId) {
        return deliveryMapper.selectDeliveryByshipmentOrderId(shipmentOrderId);
    }
}
